<?php
session_start();
$id = intval($_REQUEST['AttendanceRecordID']);
$username = $_SESSION['loginusername'];

include 'conn.php';
$check = mysql_query("Select * from attendancerecord where AttendanceRecordID=$id AND Status='Not Verified'");
if (mysql_num_rows($check)==1) {
    $sql = "UPDATE attendancerecord SET Status='Verified', AuditVerify='".$username."' where AttendanceRecordID=$id";

    $result = @mysql_query($sql);
    if ($result) {
        echo json_encode(array('success' => true));
    } else {
        echo json_encode(array('msg' => 'Attendance could not be Verified!'));
    }
}
else
{
    echo json_encode(array('msg' => 'Attendance has already been Verified!'));
}
?>